﻿using System.Collections;
using System.Collections.Generic;

using UnityEditor;
using UnityEditor.EventSystems;

using UnityEngine;
using UnityEngine.EventSystems;

[CustomEditor(typeof(UGUIEventTriggerListener), true)]
public class UGUIEventTriggerListenerEditor : EventTriggerEditor
{
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        UGUIEventTriggerListener listener = target as UGUIEventTriggerListener;
        GUI.changed = false;

        UGUIEventType forwardEvents = (UGUIEventType)EditorGUILayout.EnumMaskPopup("Forward Events", listener.forwardEvents);
        UGUIEventType reRaycastEvents = (UGUIEventType)EditorGUILayout.EnumMaskPopup("Re-Raycast Events", listener.reRaycastEvents);
        bool cancelClickEventOnMove = EditorGUILayout.ToggleLeft("Cancel Click On Move", listener.cancelClickEventOnMove);

        if (GUI.changed)
        {
            UGUIEditorTools.RegisterUndo("Forward Event Change", listener);
            listener.forwardEvents = forwardEvents;
            listener.reRaycastEvents = reRaycastEvents;
            listener.cancelClickEventOnMove = cancelClickEventOnMove;
            UGUITools.SetDirty(listener);
        }
    }
}